package com.example.myapplication.Config;

import android.os.Handler;
import android.util.Log;

import com.example.myapplication.ShuJu.ClaimDdetailsBean;
import com.google.gson.Gson;

import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.net.URL;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class SendBean {
    public  static OkHttpClient okHttpClient = new OkHttpClient();
    public  static Gson gson = new Gson();
    public  static Handler handler =new Handler() ;



    public Object send(URL url , Request request,Object bean){
        request =  new Request.Builder()
                .url(url)
                .addHeader("Authorization", TokenBean.token)
                .build();

        okHttpClient.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure(@NotNull Call call, @NotNull IOException e) {
                e.printStackTrace();
            }

            @Override
            public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
                String json =  response.body().string();
                Log.d("xjson",json);
                Object o = gson.fromJson(json, Object.class);
                handler.post(new Runnable() {
                    @Override
                    public void run(){
                    }
                });
            }
        });
        return  null;
    }
}
